#ifdef		_WIN32
#include	"ThreadWin.hpp"

bool		ThreadWin::create(myThread *var, void *(*pt2Func)(void *),void *param)
{
	bool	ret = true;
	LPDWORD 	toto = 0;
	*var = CreateThread(NULL, NULL,(LPTHREAD_START_ROUTINE) pt2Func, param, NULL, toto);
	if (*var == NULL)
		ret = false;
	return (ret);
}

void			ThreadWin::teminate(myThread *var)
{
	TerminateThread(*var, 1);
	return ;
}

void			ThreadWin::waitSingle(myThread *var)
{
	WaitForSingleObject(*var,INFINITE);
	return ;
}
void			ThreadWin::waitMultiple(myThread *var, int nb)
{
	WaitForMultipleObjects(nb, var, TRUE, INFINITE); //pour attendre plusieurs threads
	return ;
}
void			ThreadWin::exit()
{
	ExitThread(0);
}
#endif /*_WIN32*/
